package cn.tang.tframe.sdm.aop.handler;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.reflect.MethodSignature;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.lang.reflect.Method;

/**
 * Created by tanghc on 17/1/18.
 */
public abstract class AbstractorAopHandler implements AopHandler {
	protected Logger logger = LoggerFactory.getLogger(this.getClass());
	@Override
	public boolean handler(ProceedingJoinPoint pjp) {
		Object[] args = pjp.getArgs();
		Method method = ((MethodSignature) pjp.getSignature()).getMethod();// 拦截的方法
		String className = pjp.getTarget().getClass().getSimpleName();// 拦截的类名
		return doHandler(pjp,args,method,className);
	}
	protected abstract boolean doHandler(ProceedingJoinPoint pjp,Object[] args,Method method,String className);
}
